This nonprovisional application claims priority under 35 U.S.C. xc2xa7119(a) on Patent Application No. 2001-373989, 2001-377257 and 2002-30979 filed in JAPAN on Dec. 7, 2001, Dec. 11, 2001 and Feb. 7, 2002, respectively, which is herein incorporated by reference.
1. Field of the Invention
The present invention relates to a distance measuring apparatus, and particularly to a distance measuring apparatus of, for example, a camera, using passive AF sensors.
2. Description of the Related Art
A distance measuring apparatus of a camera using an AF sensor in a passive method captures images of a distance measurement object by, for example, a pair of left and right line sensors, and obtains left and right sensor images (AF data). In the AF data obtained from the pair of left and right sensors, a pair of window ranges for obtaining a pair of AF data for use in a correlation value calculation are determined, and the pair of AF data for use in the correlation value calculation are sequentially obtained by shifting the pair of window ranges in the opposite directions in a pair of predetermined sensor areas (employed sensors). Otherwise, a pair of AF data for use in a correlation value calculation are sequentially obtained with one window range fixed, and another window range shifted. A distance from a distance measurement object is calculated according to a shift amount of the pair of window ranges when the highest correlation value (smallest minimum value) is obtained by obtaining the correlation of the obtained pair of AF data (i.e., when the left and right sensor images in the pair of employed sensors match each other) (refer to Japanese Patent Application Publication Nos. 8-285580 and 11-23957, and Japanese Patent No. 3099603, etc.).
When the highest correlation is obtained by a correlation value calculation of AF data as described above, the frequency of the correlation value calculations increases if the number of pixels of the AF data is large, thereby prolonging the distance measuring time.
Furthermore, when the distance from a distance measurement object is obtained as described above, and if the number of pixels of AF data becomes large, then the frequency of the correlation value calculations increases, thereby prolonging the distance measuring time. Therefore, Japanese Patent Application Publication No. 10-26525 discloses a distance measuring method in which discretely distributed pixels to be calculated are selected from the AF data, a correlation value calculation (uni-pixel correlation value calculation) is performed only on the selected pixels to be calculated, the correlation value of each pixel to be calculated is added for each shift amount, and the shift amount is obtained according to a total correlation value. Thus, the distance measuring time is shortened.
However, in the conventional distance measuring method, each correlation value is added for each shift amount after the uni-pixel correlation calculation of each pixel to be calculated. Therefore, there is the problem that all of the uni-pixel correlation calculations are to be stored.
Furthermore, a correlation value has conventionally been calculated for each shift amount while shifting the window range in a pixel unit, and the shift amount of the pair of window ranges when the highest correlation can be obtained from the calculated correlation value is determined. Therefore, if the number of pixels of an AF sensor becomes large, the frequency of the correlation value calculations increases, and the distance measuring time is prolonged.
Furthermore, in the distance measuring method described in the above-mentioned Japanese Patent Application Publication No. 10-26525, the distance measuring time can be shortened, but the distance measurement precision is reduced. Accordingly, to solve the problem, the following distance measuring method can be suggested. First, not all of the AF data in the window range are used, but the AF data at predetermined intervals of pixels (for example, each third pixel) is used to obtain the correlation value of a window range for each shift amount. When the highest correlation value (smallest minimum value) in the thus obtained correlation values is obtained, the shift amount is determined. At this time, the frequency of performing the correlation value calculation can be much lower than in obtaining the correlation value using all the AF data.
Then, the correct correlation value is calculated in the correlation value calculation using all AF data in the window ranges in predetermined ranges before and after the shift amount of the window ranges when the above highest correlation value is detected. The shift amount obtained when the highest correlation value is obtained in the correlation values thus calculated is determined, and the distance from the distance measurement object is calculated according to the shift amount. Thus, the distance measuring time can be shortened without reducing the distance measurement precision.
However, when the above-mentioned method is adopted, a false highest correlation value can be induced by the correlation values obtained from the AF data at predetermined intervals of pixels with a shift amount quite different from the shift amount of the true highest correlation value, since not all AF data are used. At this time, the true highest correlation value cannot be detected although a correct correlation value is calculated using all AF data before and after the shift amount of the false highest correlation value, thereby possibly making an erroneous measurement.
The present invention has been achieved to solve the above-mentioned problems, and aims at providing a distance measuring apparatus which can shorten the distance measuring time without reducing any measurement precision, and prevent an erroneous measurement.
To attain the above-described object, the present invention is directed to a distance measuring apparatus, comprising: an AF data generating device which forms images of light from a distance measurement object on a pair of line sensors comprising a plurality of light-receiving elements and generates a pair of AF data for correlation value calculation according to signals obtained from the plurality of light-receiving elements; an AF data obtaining device which obtains a pair of AF data from a pair of employed sensor ranges for use in distance measurement in the pair of line sensors; a first correlation value calculating device which determines a pair of window ranges for obtaining the pair of AF data for use in the correlation value calculation in the pair of employed sensor ranges, and sequentially calculates correlation values while shifting the pair of window ranges to obtain a highest correlation value in the pair of employed sensor ranges, the first correlation value calculating device calculating the correlation values using AF data arranged at predetermined intervals in the AF data in the pair of window ranges; a second correlation value calculating device which sequentially calculates correlation values while shifting the pair of window ranges in predetermined ranges before and after a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the first correlation value calculating device is obtained, the second correlation value calculating device calculating the correlation values using all AF data in the pair of window ranges; and a distance measurement object distance calculating device which calculates a distance from the distance measurement object according to a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the second correlation value calculating device is obtained.
According to the present invention, the first correlation value calculating device can reduce the frequency of calculations in performing the correlation value calculation using the AF data at predetermined intervals in the AF data in the pair of window ranges while the second correlation value calculating device performs the correlation value calculation using all AF data in the pair of window ranges in the predetermined ranges before and after the shift amount of the pair of window ranges when the highest correlation value is obtained in the correlation values obtained by the first correlation value calculating device, thereby suppressing the reduction of measurement precision.
Preferably, when there are a plurality of extrema indicating high correlation as a result of correlation value calculation in the employed sensors by the first correlation value calculating device, the first correlation value calculating device defines a highest extremum as a provisional first extremum, and defines a second highest extremum as a provisional second extremum; and if a difference between the provisional first extremum and the provisional second extremum is within a predetermined reference value, the second correlation value calculating device calculates correlation values respectively in predetermined ranges before and after a shift amount of the pair of window ranges when the provisional first extremum is obtained and in predetermined ranges before and after a shift amount of the pair of window ranges when the provisional second extremum is obtained. When the difference between the provisional first extremum and the provisional second extremum is smaller than the predetermined reference value, it is uncertain which extremum is closer to the highest correlation value.
Preferably, the distance measuring apparatus further comprises: a device which obtains: a difference between a first shift amount of the pair of window ranges when the provisional first extremum is obtained by the first correlation value calculating device and a third shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device; and a difference between a second shift amount of the pair of window ranges when the provisional second extremum is obtained by the first correlation value calculating device and the third shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device; and a determining device which, when smaller one of the obtained differences exceeds a predetermined shift amount, determines that the distance measurement is impossible.
According to the present invention, it is determined whether or not a distance measurement can be made depending on the difference between one of the first shift amount of the first extremum and the second shift amount of the second extremum closer to the shift amount of the highest correlation value (third shift amount) and the third shift amount.
Preferably, the distance measuring apparatus further comprises: a device which obtains a difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device; and a determining device which, when the obtained difference exceeds a predetermined shift amount, determines that the distance measurement is impossible. When the difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device exceeds the predetermined shift amount, each of the obtained shift amounts is not reliable, and possibly makes an erroneous measurement.
Preferably, the distance measuring apparatus further comprises: a device which obtains a difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device, wherein the second correlation value calculating device performs an additional correlation value calculation beyond the predetermined range by the obtained difference in the shift amounts.
According to the present invention, there are sufficient correlation values for use in the interpolation value calculation when the true highest correlation value is obtained in the interpolation value calculation.
Preferably, the distance measurement object distance calculating device obtains a shift amount of the pair of window ranges with which a true highest correlation value is obtained by an interpolating operation according to the highest correlation value in the correlation values obtained by the second correlation value calculating device and correlation values of the predetermined ranges before and after the highest correlation value in the correlation values obtained by the second correlation value calculating device, and calculates the distance from the distance measurement object according to the shift amount.
The highest correlation value obtained by the second correlation value calculating device is the highest correlation value in the discrete correlation values. However, according to the present invention, the shift amount of the true highest correlation value that is not discrete can be obtained.
Preferably, the distance measuring apparatus further comprises: a determining device which determines whether or not the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device is within a shorter unnecessary distance measurement range; and a device which stops the correlation value calculation by the second correlation value calculating device when the determining device determines that the shift amount is within the shorter unnecessary distance measurement range, wherein when the determining device determines that the shift amount is within the shorter unnecessary distance measurement range, the distance measurement object distance calculating device calculates the distance from the distance measurement object according to the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device.
Preferably, the pair of employed sensors are sensors for the entire measurement area of the pair of line sensors. Alternatively, the entire measurement area of each of the pair of line sensors is divided into a plurality of subareas, and the pair of employed sensors are sensors for the subareas. In the latter case, even if a distance measurement cannot be made in an employed sensor, another employed sensor can make a distance measurement.
In order to attain the above-described object, the present invention is also directed to a distance measuring apparatus, comprising: an AF data generating device which forms images of light from a distance measurement object on a pair of line sensors comprising a plurality of light-receiving elements and generates a pair of AF data for correlation value calculation according to signals obtained from the plurality of light-receiving elements; an AF data obtaining device which obtains a pair of AF data from a pair of employed sensor ranges for use in distance measurement in the pair of line sensors; a first correlation value calculating device which determines a pair of window ranges for obtaining the pair of AF data for use in the correlation value calculation in the pair of employed sensor ranges, and sequentially calculates correlation values while shifting the pair of window ranges to obtain a highest correlation value in the pair of employed sensor ranges, the first correlation value calculating device calculating the correlation values using AF data in the pair of window ranges for each shift amount of the pair of window ranges when the pair of window ranges are shifted at predetermined intervals with an interval of a shift amount of the pair of window ranges when the pair of window ranges are shifted by a pixel being defined as a shortest interval; a second correlation value calculating device which sequentially calculates correlation values while shifting the pair of window ranges in predetermined ranges at the shortest intervals before and after a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the first correlation value calculating device is obtained; and a distance measurement object distance calculating device which calculates a distance from the distance measurement object according to a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the second correlation value calculating device is obtained.
According to the present invention, the first correlation value calculating device calculates the correlation value for each shift amount when the pair of window ranges are shifted at the predetermined intervals, thereby reducing the frequency of the correlation value calculation. The second correlation value calculating device calculates the correlation value for each shift amount at the shortest intervals within predetermined ranges before and after the shift amount when the highest correlation value is obtained in the correlation values obtained by the first correlation value calculating device, thereby suppressing the reduction of measurement precision.
Preferably, the first correlation value calculating device performs the correlation value calculation for each shift amount of the pair of window ranges at the shortest interval in predetermined ranges in vicinity of a smallest one and a largest one of the shift amounts of the pair of window ranges.
If the shift amount of the pair of window ranges when the highest correlation value is obtained is close to the smallest or largest one of the shift amounts, the shift amount when the highest correlation value is obtained may not be calculated only from the correlation value calculated by using the shift amounts at predetermined intervals. However, according to the present invention, the shift amount when the highest correlation value is obtained can be appropriately determined even in the case above.
Preferably, when there are a plurality of extrema indicating high correlation as a result of correlation value calculation in the employed sensors by the first correlation value calculating device, the first correlation value calculating device defines a highest extremum as a provisional first extremum, and defines a second highest extremum as a provisional second highest value; and if a difference between the provisional first extremum and the provisional second extremum is within a predetermined reference value, the second correlation value calculating device calculates correlation values respectively in predetermined ranges before and after a shift amount of the pair of window ranges when the provisional first extremum is obtained and in predetermined ranges before and after a shift amount of the pair of window ranges when the provisional second extremum is obtained. When the difference between the provisional first extremum and the provisional second extremum is smaller than the predetermined reference value, it is uncertain which extremum is closer to the highest correlation value.
Preferably, on a shift amount of the pair of window ranges for which the correlation value has been obtained by the first correlation value calculating device in the shift amounts in the range of the correlation value calculation to be performed by the second correlation value calculating device, the second correlation value calculating device does not perform the correlation value calculation and defines the correlation value obtained by the first correlation value calculating device as the correlation value obtained by the second correlation value calculating device.
According to the present invention, a duplicate calculation using the same shift amount can be avoided, thereby shortening the distance measuring time.
Preferably, the distance measuring apparatus further comprises: a device which obtains a difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device; and a determining device which, when the obtained difference exceeds a predetermined shift amount, determines that the distance measurement is impossible. When the difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device exceeds the predetermined shift amount, each of the obtained shift amounts is not reliable, and possibly makes an erroneous measurement.
Preferably, the distance measuring apparatus further comprises: a device which obtains a difference between the shift amount of the pair of window ranges when the highest correlation value is obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the highest correlation value is obtained by the second correlation value calculating device, wherein the second correlation value calculating device performs an additional correlation value calculation beyond the predetermined range by the obtained difference in the shift amounts.
According to the present invention, there are sufficient correlation values for use in the interpolation value calculation when the true highest correlation value is obtained in the interpolation value calculation.
Preferably, the distance measurement object distance calculating device obtains a shift amount of the pair of window ranges with which a true highest correlation value is obtained by an interpolating operation according to the highest correlation value in the correlation values obtained by the second correlation value calculating device and correlation values of the predetermined ranges before and after the highest correlation value in the correlation values obtained by the second correlation value calculating device, and calculates the distance from the distance measurement object according to the shift amount.
The highest correlation value obtained by the second correlation value calculating device is the highest correlation value in the discrete correlation values. However, according to the present invention, the shift amount of the true highest correlation value that is not discrete can be obtained.
Preferably, the distance measuring apparatus further comprises: a contrast determining device which determines whether or not contrast of the pair of AF data obtained by the AF data obtaining device is higher than a predetermined reference value; a third correlation value calculating device which determines a pair of window ranges for obtaining the pair of AF data for use in the correlation value calculation in the pair of employed sensor ranges, and sequentially calculates correlation values while shifting the pair of window ranges to obtain a highest correlation value in the pair of employed sensor ranges, the third correlation value calculating device calculating the correlation values using AF data arranged at predetermined intervals in the AF data in the pair of window ranges; a fourth correlation value calculating device which sequentially calculates correlation values while shifting the pair of window ranges in predetermined ranges before and after a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the third correlation value calculating device is obtained, the fourth correlation value calculating device calculating the correlation values using all AF data in the pair of window ranges; and a correlation value calculation selecting device which selects and performs the correlation value calculation by the third correlation value calculating device and the fourth correlation value calculating device when the contrast determining device determines that the contrast of the pair of AF data is higher than the predetermined reference value, and selects and performs the correlation value calculation by the first correlation value calculating device and the second correlation value calculating device when the contrast determining device determines that the contrast of the pair of AF data is not higher than the predetermined reference value, wherein the distance measurement object distance calculating device calculates the distance from the distance measurement object according to a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by one of the second correlation value calculating device and the fourth correlation value calculating device selected for the correlation value calculation by the correlation value calculation selecting device is obtained.
According to the present invention, so as to shorten the distance measuring time without reducing any measurement precision, the third correlation value calculating device performs a correlation value calculation by using AF data at predetermined intervals in the AF data in the window range, so that the distance measuring time is shortened, then, the fourth correlation value calculating device performs a correlation value calculation by using all AF data in the window range in the predetermined ranges before and after the shift amount of the pair of the window ranges when the highest correlation value is obtained in the correlation values calculated by the third correlation value calculating device, thereby determining the shift amount of the pair of the window ranges when the highest correlation value is obtained from the correlation value obtained therefrom, and suppressing the reduction of measurement precision by obtaining the distance from the distance measurement object according to the shift amount. The third and fourth correlation value calculating devices are effective when the contrast of the AF data is high. However, when the contrast of the AF data is low, there is the possibility of an erroneous measurement with the third and fourth correlation value calculating devices. Therefore, the third and fourth correlation value calculating devices are used when the contrast of the AF data is high, and the first and second correlation value calculating devices are used for the correlation value calculation when the contrast of the AF data is low.
Preferably, the pair of employed sensors are sensors for the entire measurement area of the pair of line sensors. Alternatively, the entire measurement area of each of the pair of line sensors is divided into a plurality of subareas, and the pair of employed sensors are sensors for the subareas. In the latter case, even if a distance measurement cannot be made in an employed sensor, another employed sensor can make a distance measurement.
In order to attain the above-described object, the present invention is also directed to a distance measuring apparatus, an AF data generating device which forms images of light from a distance measurement object on a pair of line sensors comprising a plurality of light-receiving elements and generates a pair of AF data for correlation value calculation according to signals obtained from the plurality of light-receiving elements; an AF data obtaining device which obtains a pair of AF data from a pair of employed sensor ranges for use in distance measurement in the pair of line sensors; a first correlation value calculating device which determines a pair of window ranges for obtaining the pair of AF data for use in the correlation value calculation in the pair of employed sensor ranges, and sequentially calculates correlation values while shifting the pair of window ranges to obtain a highest correlation value in the pair of employed sensor ranges, the first correlation value calculating device calculating the correlation values using AF data arranged at n pixel intervals in the AF data in the pair of window ranges; a second correlation value calculating device which sequentially calculates correlation values while shifting the pair of window ranges in predetermined ranges before and after a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the first correlation value calculating device is obtained, the second correlation value calculating device calculating the correlation values using all AF data in the pair of window ranges; and a distance measurement object distance calculating device which calculates a distance from the distance measurement object according to a shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the second correlation value calculating device is obtained, wherein when a difference between a shift amount of the pair of window ranges when a highest correlation extremum is obtained in the correlation values obtained by the first correlation value calculating device and a shift amount of the pair of window ranges when a second highest correlation extremum is obtained equals a multiple of 2(n+1), the second correlation value calculating device calculates the correlation values in a range of all shift amounts of the pair of window ranges in the ranges of the employed sensors.
According to the present invention, the first correlation value calculating device obtains the correlation values by using the AF data at the intervals of n pixels. Then, in the predetermined ranges before and after the shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the first correlation value calculating device is obtained, the second correlation value calculating device obtains the correct correlation value by using all the AF data. Then, the distance from the distance measurement object is obtained according to the shift amount of the pair of window ranges when the highest correlation value in the correlation values obtained by the second correlation value calculating device is obtained. Thus, by obtaining the correlation values using the AF data at the predetermined intervals of pixels, the frequency of calculation in the correlation value calculation can be reduced, thereby shortening the distance measuring time. Furthermore, the correct correlation value is obtained by using all the AF data in the ranges before and after the shift amount of the pair of window ranges when the highest correlation value is obtained in the correlation values acquired by using the AF data at the predetermined intervals of pixels, and the distance from the distance measurement object is obtained according to the shift amount of the pair of window ranges when the highest correlation value is obtained in the correlation values, thereby suppressing the reduction of measurement precision.
In the distance measuring calculation thus performed with a view to shortening the distance measuring time, when the difference between the shift amount of the pair of window ranges when the highest correlation extremum is obtained in the correlation values obtained by using the AF data arranged at the intervals of n pixels and the shift amount of the pair of window ranges when the second highest correlation extremum is obtained is equal to a multiple of 2(n+1), these extrema can be false extrema induced by the calculation of the correlation value using the AF data at the intervals of n pixels. Therefore, in this case, the true correlation value is obtained in the normal correlation value calculation by the second correlation value calculating device by using all the AF data according to the shift amounts of all window ranges in the employed sensor ranges, and the distance from the distance measurement object is obtained. Thus, an erroneous measurement can be avoided.
Preferably, also when the difference between the shift amount of the pair of window ranges when the highest correlation extremum is obtained in the correlation values obtained by the first correlation value calculating device and the shift amount of the pair of window ranges when the second highest correlation extremum is obtained equals {a multiple of 2(n+1)}xc2x11, the second correlation value calculating device calculates the correlation values in the range of all shift amounts of the pair of window ranges in the ranges of the employed sensors. In this case, these extrema can be false extrema induced by the calculation of the correlation value using the AF data at the intervals of n pixels. Therefore, the true correlation value is obtained in the normal correlation value calculation by the second correlation value calculating device using all the AF data according to the shift amounts of all window ranges in the employed sensor ranges, and the distance from the distance measurement object is obtained. Thus, an erroneous measurement can be avoided.
Preferably, only when a difference between the highest correlation extremum and the second highest correlation extremum in the correlation values obtained by the first correlation value calculating device is smaller than a predetermined value, the second correlation value calculating device calculates the correlation values in the range of all shift amounts in the ranges of the employed sensors. Although the difference between the shift amount of the pair of window ranges when the highest correlation extremum is obtained and the shift amount of the pair of window ranges when the second highest correlation extremum is obtained is equal to a multiple of 2(n+1) or to {a multiple of 2(n+1)}xc2x11, the highest correlation extremum is reliable if the difference between the highest correlation extremum and the second highest correlation extremum is equal to or larger than the predetermined value. Therefore, the correlation value is calculated in the correlation value calculation using all the AF data only in the predetermined ranges before and after the shift amount of the window ranges when the highest correlation extremum is obtained, thereby obtaining the distance from the distance measurement object.
Preferably, the pair of employed sensors are sensors for the entire measurement area of the pair of line sensors. Alternatively, the entire measurement area of each of the pair of line sensors is divided into a plurality of subareas, and the pair of employed sensors are sensors for the subareas. In the latter case, even if a distance measurement cannot be made in an employed sensor, another employed sensor can make a distance measurement.